package com.hqyj.service.impl;

import com.hqyj.dao.SettingMapper;
import com.hqyj.pojo.Setting;
import com.hqyj.service.SettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.List;

@Service
public class SettingServiceImpl implements SettingService {

    @Autowired
    private SettingMapper settingMapper;
   /* public Setting selectByPrimaryKey() {
        return settingMapper.selectByPrimaryKey();
    }*/
    public HashMap<String, Object> selectAll() {
        HashMap<String,Object> map =new HashMap<String, Object>();
        List<Setting>  list= settingMapper.selectList();
        if(list.size()>0){
            map.put("info",list);
        }else{
            map.put("info","0");
        }
        return map;


    }
    public HashMap<String, Object> update(Setting s) {
       HashMap<String,Object> map =new HashMap<String, Object>();
        int i = settingMapper.updateByPrimaryKeySelective(s);
        System.out.println("-------------------"+i);
       //修改
        if(i > 0){
            map.put("info","修改成功");
        }else{
            map.put("info","修改失败");
        }
        return map;
    }
}
